﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using WS1.Models;
using WS1.Repository;

namespace WS1.Services
{
	public class OrdersServices:IDisposable
    {
        private readonly OrdersRepository _ordersRepository;

        public OrdersServices()
        {
            _ordersRepository = new OrdersRepository();
        }

        public IEnumerable<Orders> GetAll()
        {
            return _ordersRepository.All();
        }
        public Orders Get(int id)
        {
            return _ordersRepository.Single(id);
        }
        public bool Add(Orders product)
        {
            return _ordersRepository.Add(product);
        }
        public bool Update(int id, Orders product)
        {
            return _ordersRepository.Update(id, product);

        }
        public bool Remove(int id)
        {
            return _ordersRepository.RemoveSingle(id);
        }
        public void Dispose()
        {
            _ordersRepository.Dispose();
        }
    }
}